﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;


namespace game_for_test_helper.src.helper
{
    /// <summary>
    /// This is a game component that implements IUpdateable.
    /// </summary>
    public class GameStaticHolder : Microsoft.Xna.Framework.GameComponent
    {
        private static ContentManager ContentHolder;
        private static Matrix worldMatrix;
        private static Matrix projectionMatrix;
        private static GraphicsDevice GraphicsDevice;
        private static VertexDeclaration vertexDeclaration;


        public GameStaticHolder(Game game)
            : base(game)
        {
            GameStaticHolder.ContentHolder = game.Content;
        }

        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            // TODO: Add your initialization code here
            base.Initialize();
            worldMatrix = Matrix.CreateWorld(Vector3.Zero, Vector3.Forward, Vector3.Up);
            projectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, (float)this.Game.GraphicsDevice.Viewport.Width / (float)this.Game.GraphicsDevice.Viewport.Height, 1, 10000);
            GameStaticHolder.GraphicsDevice1 = this.Game.GraphicsDevice;
            vertexDeclaration = new VertexDeclaration(GraphicsDevice, VertexPositionColor.VertexElements);
        }

        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            // TODO: Add your update code here

            base.Update(gameTime);
        }
        public static ContentManager ContentHolder1
        {
            get { return GameStaticHolder.ContentHolder; }
            set { GameStaticHolder.ContentHolder = value; }
        }

        public static Matrix WorldMatrix
        {
            get { return GameStaticHolder.worldMatrix; }
            set { GameStaticHolder.worldMatrix = value; }
        }

        public static Matrix ProjectionMatrix
        {
            get { return GameStaticHolder.projectionMatrix; }
            set { GameStaticHolder.projectionMatrix = value; }
        }

        public static GraphicsDevice GraphicsDevice1
        {
            get { return GameStaticHolder.GraphicsDevice; }
            set { GameStaticHolder.GraphicsDevice = value; }
        }
        public static VertexDeclaration VertexDeclaration
        {
            get { return GameStaticHolder.vertexDeclaration; }
            set { GameStaticHolder.vertexDeclaration = value; }
        }
    }
}